
package com.viweb.storemanager.ui;


import com.jidesoft.swing.JideTabbedPane;
import com.viweb.storemanager.entity.WareHouse;

public class MyCafePnl extends javax.swing.JPanel {

    //private ArrayList<TablePnl> universalTableList;

    /** Creates new form MyCafePnl */
    public MyCafePnl() {
        this.initComponents();
        this.initAreasAndTables();
        this.setEnable(false);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        tabMyCafe = new JideTabbedPane();

        setLayout(new java.awt.BorderLayout());

        ((JideTabbedPane) tabMyCafe).setTabShape(JideTabbedPane.SHAPE_DEFAULT);
        ((JideTabbedPane) tabMyCafe).setBoldActiveTab(true);
        add(tabMyCafe, java.awt.BorderLayout.CENTER);
    }// </editor-fold>//GEN-END:initComponents

    private void initAreasAndTables() {
//        this.universalTableList = new ArrayList<TablePnl>();
//
//        ArrayList<Area> areas = MyCafeBiz.getAreas();
//        for (Area area : areas) {
//            ArrayList<TablePnl> tables = new ArrayList<TablePnl>();
//            for (Table table : area.getTables()) {
//                TablePnl tablePnl = new TablePnl(this, table);
//                tables.add(tablePnl);
//                this.universalTableList.add(tablePnl);
//            }
//
//            this.tabMyCafe.addTab(area.getName(), new AreaPnl(tables));
//        }
    }

    public void updateMyCafeUI() {
        this.tabMyCafe.removeAll();
        this.initAreasAndTables();
    }

    public void updateTableUI(WareHouse table) {
//        for (TablePnl item : this.universalTableList) {
//            if (item.getTable().getID() == table.getID()) {
//                if (table.getPayment() != null) {
//                    item.setIsInUse(true);
//                } else {
//                    item.setIsInUse(false);
//                }
//                break;
//            }
//        }
    }

    public void setEnable(boolean enable) {
        this.tabMyCafe.setEnabled(enable);

//        for (TablePnl item : this.universalTableList) {
//            item.setEnable(enable);
//        }
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTabbedPane tabMyCafe;
    // End of variables declaration//GEN-END:variables
}
